package com.simon.resourcestatistics.dao;

import javax.transaction.Transactional;

import com.simon.resourcestatistics.model.ReadRoom;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * IReadRoomDao
 */
public interface IReadRoomDao extends JpaRepository<ReadRoom,Integer>,JpaSpecificationExecutor<ReadRoom>{

    @Transactional
    @Modifying//通知jpa这是一个update或者delete操作
    @Query("delete from ReadRoom r where r.id=?1")
    int delById(int id);

    @Transactional
    @Modifying
    @Query("update ReadRoom r set r.name=:name,r.remark=:remark where r.id=:id")
    int editReadRoom(Integer id,String name,String remark);
    
}